import Dep from "./Dep.js";

export function defineReactive(data,key) {
    let dep=new Dep();
    Object.defineProperty(data,key,{
        enumerable:true,
        configurable:true,
        get() {
            //更新依赖
            console.log("get");
            dep.depend();
        },
        set(v) {
            console.log("set");
            dep.notify();
        }
    })
}
console.log("JS文件开始运行");
let person={};
person.name='a';
defineReactive(person,'name');
person.name='b';
console.log(person.name)